package cn.wsalix.weixin.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.BasicEntity;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "WX_ACCESS_TOKEN")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false)
public class WxAccessToken extends BasicEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 198529133560255071L;
	@Id
	private Long id;
	
	@OneToOne(optional = false, cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
	@MapsId
	@JoinColumn(name = "ID")
	private WxUser wxUser;// 支付账号
	
	private String access_token;
	private String expires_in;
	private String refresh_token;
	private String openid;
	private String scope;
	private String unionid;
	
	private String ret;
	private String pay_token;
	private String pf;
	private String pfkey;
	private String msg;
	private String login_cost;
	private String query_authority_cost;
	private String authority_cost;
}
